# 1、六爻皆不变者，则占本卦卦辞；
# 2、一爻变者，则以本卦变爻之辞占；
# 3、二爻变者，则以本卦二变爻之辞占，而以上爻之辞为主；
# 4、三爻变者，则占本卦及之卦的卦辞，而以本卦为主；
# 5、四爻变者，则以之卦中二不变之爻辞占；
# 6、五爻变者，则以之卦中不变爻的爻辞占；
# 7、六爻皆变者，则以乾坤二用之辞占，并参考其之卦卦辞。

import random
import math


class Hexagram:

    def __init__(self):
        self.copper_money_1 = 0
        self.copper_money_2 = 0
        self.copper_money_3 = 0
        self.copper_money_arr = []

    def random_copper(self, count):
        if count < 1:
            print("invalid param")
            return

        front = 0
        contrary = 0

        for i in range(0, count):
            seed = math.floor(random.random() * 10)
            if seed >= 5:
                front = front + 1
            else:
                contrary = contrary + 1

        if front > contrary:
            return 1
        else:
            return 0

    def main(self, count):
        self.copper_money_arr = []
        self.copper_money_1 = self.random_copper(count)
        self.copper_money_2 = self.random_copper(count)
        self.copper_money_3 = self.random_copper(count)
        if self.copper_money_1 is 1 and self.copper_money_2 is 1 and self.copper_money_3 is 1:
            self.copper_money_arr.append("X")
        elif self.copper_money_1 is 0 and self.copper_money_2 is 0 and self.copper_money_3 is 0:
            self.copper_money_arr.append("O")
        elif self.copper_money_1 is 1 and self.copper_money_2 is 0 and self.copper_money_3 is 0:
            self.copper_money_arr.append("、、")
        elif self.copper_money_1 is 0 and self.copper_money_2 is 1 and self.copper_money_3 is 0:
            self.copper_money_arr.append("、、")
        elif self.copper_money_1 is 0 and self.copper_money_2 is 0 and self.copper_money_3 is 1:
            self.copper_money_arr.append("、、")
        elif self.copper_money_1 is 1 and self.copper_money_2 is 1 and self.copper_money_3 is 0:
            self.copper_money_arr.append("、")
        elif self.copper_money_1 is 1 and self.copper_money_2 is 0 and self.copper_money_3 is 1:
            self.copper_money_arr.append("、")
        elif self.copper_money_1 is 0 and self.copper_money_2 is 1 and self.copper_money_3 is 1:
            self.copper_money_arr.append("、")


if __name__ == '__main__':
    a = Hexagram()
    count = random.randint(1, 10)
    for i in range(1, 7):
        a.main(count)
        if i is 1:
            print("初爻结果：")
        elif i is 2:
            print("二爻结果：")
        elif i is 3:
            print("三爻结果：")
        elif i is 4:
            print("四爻结果：")
        elif i is 5:
            print("五爻结果：")
        elif i is 6:
            print("上爻结果：")
        print(a.copper_money_arr)
